﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCoreLib.Automation.Data.SqlClient.Model
{
    public class DbObjectInfo
    {
        public readonly string Schema;
        public readonly string Name;
        public readonly string FullName;

        public DbObjectInfo(IDbObject dbObject)
        {
            if (ReferenceEquals(dbObject, null))
            {
                throw new ArgumentNullException("dbObject");
            }
            var genericDbObject = dbObject as GenericDbObject ?? new GenericDbObject(dbObject);
            Schema = genericDbObject.Schema;
            Name = genericDbObject.Name;
            FullName = genericDbObject.FullName;
        }

        public override string ToString()
        {
            return FullName;
        }
    }
}
